home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / lib / partman / check.d / 10check_swap < prev    next >
Encoding:
Text File  |  2007-04-12  |  1.6 KB  |  60 lines

  1. #!/bin/sh
  2.  
  3. . /lib/partman/definitions.sh
  4.  
  5. swap=false
  6.  
  7. for dev in $DEVICES/*; do
  8.     [ -d "$dev" ] || continue
  9.     cd $dev
  10.     partitions=
  11.     open_dialog PARTITIONS
  12.     while { read_line num id size type fs path name; [ "$id" ]; }; do
  13.     [ "$fs" != free ] || continue
  14.         partitions="$partitions $id,$num"
  15.     done
  16.     close_dialog
  17.     
  18.     for part in $partitions; do
  19.         id=${part%,*}
  20.         num=${part#*,}
  21.     [ -f $id/method ] || continue
  22.     method=$(cat $id/method)
  23.     if [ "$method" = swap ]; then
  24.         swap=:
  25.         fi
  26.     [ ! -f $id/format ] || continue
  27.     if [ "$method" = swap ]; then
  28.         log "Check the swap space in $dev/$id"
  29.         template=partman-basicfilesystems/progress_swap_checking
  30.         db_subst $template PARTITION "$num"
  31.         db_subst $template DEVICE $(humandev $(cat device))
  32.         name_progress_bar $template
  33.         open_dialog CHECK_FILE_SYSTEM $id
  34.         read_line status
  35.         close_dialog
  36.         if [ "$status" != good ]; then
  37.         db_subst partman-basicfilesystems/swap_check_failed PARTITION "$num"
  38.         db_subst partman-basicfilesystems/swap_check_failed DEVICE $(humandev $(cat device))
  39.         db_set partman-basicfilesystems/swap_check_failed 'true'
  40.         db_input critical partman-basicfilesystems/swap_check_failed || true
  41.         db_go || true
  42.         db_get partman-basicfilesystems/swap_check_failed
  43.         if [ "$RET" = 'true' ]; then
  44.             exit 1
  45.         fi
  46.         fi
  47.     fi
  48.     done
  49. done
  50.  
  51. if ! $swap; then
  52.     db_set partman-basicfilesystems/no_swap true
  53.     db_input critical partman-basicfilesystems/no_swap || true
  54.     db_go || true
  55.     db_get partman-basicfilesystems/no_swap
  56.     if [ "$RET" = true ]; then
  57.     exit 1
  58.     fi
  59. fi
  60.